package se.thoka.twt.client.event;

import com.google.gwt.event.shared.GwtEvent;

public class ListItemMouseOutEvent<LI> extends GwtEvent<ListItemMouseOutHandler<LI>>{

	private static final Type<ListItemMouseOutHandler<?>> TYPE = new Type<ListItemMouseOutHandler<?>>();
	
	private LI listItem;
	private int listIndex;
	
	/**
	 * Creates a new instance of {@link ListItemMouseOutEvent}
	 * @param listItem The list item
	 * @param listIndex The list index
	 */
	public ListItemMouseOutEvent(LI listItem, int listIndex) {
		this.listItem = listItem;
		this.listIndex = listIndex;
	}

	/**
	 * @return The list item
	 */
	public LI getListItem() {
		return listItem;
	}

	/**
	 * @return The list item index
	 */
	public int getListIndex() {
		return listIndex;
	}
	
	@Override
	protected void dispatch(ListItemMouseOutHandler<LI> handler) {
		handler.onListItemMouseOutEvent(this);
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public Type<ListItemMouseOutHandler<LI>> getAssociatedType() {
		return (Type) getType();
	}

	public static Type<ListItemMouseOutHandler<?>> getType() {
		return TYPE;
	}
}
